// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.brest.managesambafilesharing;


// Referenced classes of package com.funkyfresh.samba:
//            ShellCmd, FileOps, LOG, SambaInfo, 
//            Misc, SambaWifiInfo

public class SambaControl {

	/*
	 * public SambaControl(Context context1) { context = context1; preferences =
	 * PreferenceManager.getDefaultSharedPreferences(context); } /* private
	 * boolean changePassword(String s, String s1) {
	 * ShellCmd.run("rm /data/data/com.funkyfresh.samba/files/smbpasswd", 2);
	 * ShellCmd.run((new
	 * StringBuilder("echo '")).append(s1).append("' | ").append
	 * ("/data/data/com.funkyfresh.samba/files/"
	 * ).append("smbpasswdbin -as '").append(s).append("'").toString(), 2);
	 * boolean flag;
	 * if(!FileOps.fileExists("/data/data/com.funkyfresh.samba/files/smbpasswd"
	 * )) flag = false; else flag = true; return flag; }
	 * 
	 * private boolean dontRewriteSmbConf() { return false; }
	 * 
	 * private String getNetbiosName() { String s =
	 * preferences.getString("netbiosname", "MYANDROID").toUpperCase();
	 * if(s.length() < 1) s = "MYANDROID"; return s; }
	 * 
	 * private String getWorkgroupName() { String s =
	 * preferences.getString("workgroup",
	 * preferences.getString("workgroupDefault", "WORKGROUP")).toUpperCase();
	 * if(s.length() < 1) s = "WORKGROUP"; return s; }
	 * 
	 * public static final boolean killallSmbProcesses() {
	 * runSambaRc("killallsamba"); return true; }
	 * 
	 * private static final boolean runSambaRc(String s) { LOG.i((new
	 * StringBuilder
	 * ("/data/data/com.funkyfresh.samba/files/samba-rc ")).append(s
	 * ).append(" SHELLSU=").append(2).toString()); boolean flag;
	 * if(ShellCmd.run((new
	 * StringBuilder("/data/data/com.funkyfresh.samba/files/samba-rc "
	 * )).append(s).toString(), 2) == null) flag = false; else flag = true;
	 * return flag; }
	 * 
	 * public static final boolean startSamba() { boolean flag = false;
	 * if(!Environment.getExternalStorageState().equals("mounted")) {
	 * LOG.e("startSamba(): Cant start - external storage not mounted"); } else
	 * { runSambaRc("start"); if(!SambaInfo.sambaIsRunning())
	 * LOG.e("startSamba() failed to start daemons"); else flag = true; } return
	 * flag; }
	 * 
	 * public static final boolean stopSamba() { runSambaRc("stop"); boolean
	 * flag; if(SambaInfo.sambaIsRunning()) flag = false; else flag = true;
	 * return flag; }
	 * 
	 * private boolean updatePasswordFromSharedPrefs() { String s =
	 * preferences.getString("password", null); boolean flag; if(s != null) {
	 * LOG.i((new
	 * StringBuilder(" changing ")).append(getUserName()).append(" password"
	 * ).toString()); flag = changePassword(getUserName(), s); } else {
	 * LOG.e((new
	 * StringBuilder(" couldnt change ")).append(getUserName()).append
	 * (" password - returned null").toString()); flag = false; } return flag; }
	 * 
	 * private boolean writeSambaConfig() { if(!dontRewriteSmbConf()) goto _L2;
	 * else goto _L1 _L1: boolean flag;
	 * LOG.i("Not rewriting smb.conf due to smb.conf.dnd presence or setting");
	 * flag = true; _L8: return flag; _L2: String s; String s1; String s2;
	 * String s3; String s5; String s6; s = Misc.getAppVersionName(context); s1
	 * = getWorkgroupName(); s2 = getNetbiosName(); s3 =
	 * Misc.getExternalStorageName(); LOG.i((new
	 * StringBuilder("External storage state = "
	 * )).append(Environment.getExternalStorageState()).toString()); LOG.i((new
	 * StringBuilder("External Storage path = ")).append(s3).toString());
	 * if(s3.length() < 1) {
	 * LOG.e("FATAL: Unable to determine external storage (sdcard) path."); flag
	 * = false; continue; } String s4 = SambaWifiInfo.getWifiName(); s5 =
	 * SambaWifiInfo.getAltIfNames(); s6 = null; if(s4 == null || s4.length() <
	 * 1) { LOG.w(
	 * " The Android property 'wifi.interface' has not been set by the device manufacturer or ROM builder (Please go and spank them) so I am unable to confirm the WIFI interface name."
	 * ); LOG.w(
	 * " See the following for instructions on how you can set the missing 'wifi.interface' property: http://forum.xda-developers.com/showpost.php?p=14650362&postcount=566  "
	 * ); } else { s6 = s4; } if(s5 != null && s5.length() >= 2) goto _L4; else
	 * goto _L3 _L3:
	 * LOG.e(" could not find or guess the active wifi interface name either.");
	 * _L6: if(s6 != null && s6.length() >= 1) break;
	 * LOG.e(" no suitable wifi network interfaces found."); LOG.e(
	 * "Unable to determine WIFI interface. Installation cannot continue. Bailing out!"
	 * ); flag = false; continue; _L4: if(s6 == null || s6 != null &&
	 * !s6.equalsIgnoreCase(s5)) s6 = (new
	 * StringBuilder(String.valueOf(s6))).append(" ").append(s5).toString();
	 * if(true) goto _L6; else goto _L5 _L5: String s9; String s7 = "";
	 * if(preferences.getBoolean("localmasterno", false)) s7 =
	 * "local master = no\n"; String s8 = "unix extensions = yes\n";
	 * if(!preferences.getBoolean("UnixExtensions", false)) s8 =
	 * "unix extensions = no\n"; s9 = (new StringBuilder(
	 * "# Auto-generated by com.funkyfresh.samba\n#\n#\n# smb.conf last written on "
	 * )).append(Misc.getDateTime()).append("  app build ").append(s).append(
	 * "\n#\n#\n"
	 * ).append("# Manual edits of smb.conf are not supported.\n#\n#\n").append(
	 * "# Sharing of non FAT based filesystems is unsupported. Do so at your own peril.\n#\n#\n"
	 * ).append("[global]\ninterfaces = ").append(s6).append("\n").append(
	 * "bind interfaces only = yes\n"
	 * ).append("workgroup = ").append(s1).append("\n"
	 * ).append("server string = Samba on Android\n"
	 * ).append("netbios name = ").append
	 * (s2).append("\n").append("remote announce = 255.255.255.255\n"
	 * ).append("encrypt passwords = yes\n"
	 * ).append("security = USER\n").append("restrict anonymous = 1\n"
	 * ).append("load printers = no\n"
	 * ).append("printcap name = /dev/null\n").append
	 * ("disable spoolss = yes\n").
	 * append("deadtime = 5\n").append("delete readonly = yes\n"
	 * ).append("nt acl support = no\n"
	 * ).append("inherit permissions = yes\n").append
	 * ("socket options = SO_SNDBUF=16384 SO_RCVBUF=16384\n"
	 * ).append(s7).append(s8
	 * ).append("\n\n[sdcard]\n").append("vfs objects = fake_perms\n"
	 * ).append("comment = Android "
	 * ).append(s3).append("\n").append("path = ").append
	 * (s3).append("\n").append
	 * ("force user = root\n").append("read only = no\n")
	 * .append("writable = yes\n").append("guest ok = no\n").toString(); String
	 * s10 = preferences.getString("share2", null); if(s10 != null &&
	 * s10.length() > 1) { s9 = (new
	 * StringBuilder(String.valueOf(s9))).append("[share2]\n"
	 * ).append("vfs objects = fake_perms\n"
	 * ).append("comment = Android ").append
	 * (s10).append("\n").append("path = ").
	 * append(s10).append("\n").append("force user = root\n"
	 * ).append("read only = no\n"
	 * ).append("writable = yes\n").append("guest ok = no\n").toString();
	 * LOG.i((new StringBuilder("second sdcard device - ")).append(s10).append(
	 * " - config has been written to conf file").toString()); }
	 * OutputStreamWriter outputstreamwriter = new
	 * OutputStreamWriter(context.openFileOutput("smb.conf", 0));
	 * outputstreamwriter.write(s9); outputstreamwriter.close(); Exception
	 * exception; if(!FileOps.fileExists((new
	 * StringBuilder("/data/data/com.funkyfresh.samba/files/"
	 * )).append("smb.conf").toString())) {
	 * LOG.e("Samba config could not be written"); flag = false; } else {
	 * ShellCmd.run((new
	 * StringBuilder("chmod 755 /data/data/com.funkyfresh.samba/files/"
	 * )).append("smb.conf").toString(), 0);
	 * LOG.i("Samba config written to disk"); flag = true; } continue;
	 * exception; LOG.e((new
	 * StringBuilder("Error writing ")).append("smb.conf").
	 * append(":  ").append(exception.getMessage()).toString()); LOG.e(
	 * " Unable to write configuration file. Installation cannot continue. Bailing out!"
	 * ); flag = false; if(true) goto _L8; else goto _L7 _L7: }
	 * 
	 * public String getUserName() { String s =
	 * preferences.getString("username", "SDCARD").toUpperCase(); if(s.length()
	 * < 1) s = "SDCARD"; return s; }
	 * 
	 * public boolean rebuildSmbConfig() { boolean flag; if(writeSambaConfig())
	 * flag = true; else flag = false; return flag; }
	 * 
	 * public boolean rebuildSmbPasswd() { boolean flag;
	 * if(updatePasswordFromSharedPrefs()) flag = true; else flag = false;
	 * return flag; }
	 * 
	 * private static final String BASEDIR =
	 * "/data/data/com.funkyfresh.samba/files/"; private static final boolean
	 * DEV_BUILD; private Context context; private SharedPreferences
	 * preferences;
	 */
}
